import org.springframework.security.crypto.bcrypt.BCrypt;

public class a {
    public static void main(String[] args) {
        //生成 随机盐值
        String gensalt = BCrypt.gensalt();
        System.out.println(gensalt);
        //密码加密
        String pwd = BCrypt.hashpw("123456",gensalt);
        System.out.println(pwd);
        //校验密码是否正确
        boolean checkpw = BCrypt.checkpw("123456",
                "$2a$10$.UI5NzfAEpjGwzFOVM.1HOZU5Yu9uyABxP5/XkqKa6vEkNuzj2wF.");
        System.out.println(checkpw);
    }
}
